package edu.zut.controller;

import edu.zut.pojo.Department;
import edu.zut.service.EmpService;
import edu.zut.service.impl.EmpServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "EmpAddServlet", value = "/emp/add")
public class EmpAddServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        EmpService empService = new EmpServiceImpl();
        List<Department> departments = empService.findDep();
        request.setAttribute("deps",departments);
        request.getRequestDispatcher("/view/addEmp.jsp").forward(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
